package com.sword.pay.example.controller;

import com.sword.common.bean.Result;
import com.sword.pay.bean.bo.PayOrder;
import com.sword.pay.bean.enums.ChannelPayEnum;
import com.sword.pay.repository.AbsPayDriverStrategy;
import com.sword.pay.solon.utils.SolonContextUtil;
import org.noear.solon.annotation.*;

/**
 * @description: 控制类
 * @author：Lv.RJ
 * @version: 1.0.0
 * @create: 2025/02/17
 **/

@Mapping("/sword")
@Controller
public class SwordController {
    // 测试登录  ---- http://localhost:8081/sword/pay

    @Mapping("pay")
    public Result pay(String type) {
        AbsPayDriverStrategy strategy = SolonContextUtil.create(ChannelPayEnum.ALIPAY.getCode(), AbsPayDriverStrategy.class);
        PayOrder payOrder = new PayOrder();
        payOrder.setAppId(type);
        strategy.initPayParam(payOrder, null, null);
        Result result = strategy.doHandler();
        return result;
    }



}